# -*- coding: utf-8 -*-
from django import forms
from .models import *

class WorkFlowForm(forms.ModelForm):
    class Meta:
        model = WorkFlow
        exclude = ['is_open']

class NodeForm(forms.ModelForm):
    class Meta:
        model = Node
        exclude = ['workflow','process']

class NodeProcessForm(forms.ModelForm):
    class Meta:
        model = NodeProcess
        fields = ['nextnode','kind']

class PartNodeProcessForm(forms.ModelForm):
    def __init__(self,workflow_id,*args, **kwargs):
        super(PartNodeProcessForm, self).__init__(*args, **kwargs)
        self.fields['nextnode'] = forms.ModelChoiceField(queryset=Node.objects.filter(workflow_id=workflow_id),label=u'下一步节点',required=True)

    class Meta:
        model = NodeProcess
        fields = ['nextnode','kind']